<template>
  <div class="login-box">
    <el-col>
        <el-input id="name"  v-model="loginform.name" placeholder="请输入帐号"  class="inputCass"></el-input>
        <el-input id="password" v-model="loginform.password" type="password" placeholder="请输入密码"  class="inputCass"></el-input>
        <el-button id="login" v-on:click="check" style="width:100%" type="primary"  class="inputCass">登录</el-button>
    </el-col>
  </div>
</template>

<script>
  // import store from '@/store/store'
  export  default {
    data(){
      return {
        loginform:{
          name:"",
          password:""
        }
      }

    },
    methods:{
      check:function (event) {
        if(this.loginform.name == '' || this.loginform.password == ''){
          this.$message({
            message : '账号或密码为空！',
            type : 'error'
          });
          return;
        }
        let tempUserInfo={
          name:'admin',
          password:"123456",
          token:"1312",
          role:"admin"
        };
        this.$store.commit('setUserFn', { data: tempUserInfo });
        this.$router.push({path: '/index/home'})
      }
    }
  }
</script>

<style scoped>

  .login-box {
    margin: 0 auto;
    width: 50%;
    margin-top:20%;
  }
  .inputCass{
    margin-top: 1rem;
  }
</style>
